import { MessageBox, Message } from "element-ui";
import { Notification } from 'element-ui';
// 操作提示弹窗
function innerNotify(message = 'default message', type = 'success') {
    Notification({
        title: "操作提示",
        type,
        message,
        position: "bottom-left",
        duration: 2000,
    });
}
// 操作对话框
function innerConfirm(title = "是否进行操作？") {
    return MessageBox.confirm(title, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
        return true;
    }).catch(() => {
        Message.info({
            message: '操作取消'
        })
        return false;
    });
}

export default {
    install(Vue) {
        Object.defineProperty(Vue.prototype, '$Notify', {
            set() { },
            get() {
                return innerNotify;
            }
        })
        Object.defineProperty(Vue.prototype, '$Confirm', {
            set() { },
            get() {
                return innerConfirm;
            }
        })
    }
}